package com.hc.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hc.dao.FFloorDAO;
import com.hc.dao.IBuildingRoomDAO;
import com.hc.dao.IBuildingUnitDAO;
import com.hc.entity.BuildingRoom;
import com.hc.entity.BuildingUnit;
import com.hc.entity.FFloor;
import com.hc.service.IRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoomServiceImpl implements IRoomService {
    IBuildingRoomDAO roomDAO;
    IBuildingUnitDAO unitDAO;
    FFloorDAO fFloorDAO;

    @Autowired
    public RoomServiceImpl(IBuildingRoomDAO roomDAO, IBuildingUnitDAO unitDAO, FFloorDAO fFloorDAO) {
        this.roomDAO = roomDAO;
        this.unitDAO = unitDAO;
        this.fFloorDAO = fFloorDAO;
    }

    @Override
    public List<FFloor> getFloorByCommunityId(String cid) {
        return fFloorDAO.getFloorByCommunityId(cid);
    }

    @Override
    public List<BuildingRoom> getRoomByUnitId(String unitId) {
        return roomDAO.getRoomsByUnitId(unitId);
    }

    @Override
    public List<BuildingUnit> getUnitByFloorId(String fid) {
        return unitDAO.getUnitByFloorId(fid);
    }
}
